package bz.yfw.example.s3blazeds.part1.behavior
{
	import bz.yfw.example.s3blazeds.part1.helper.TopHelper;
	import bz.yfw.example.s3blazeds.part1.helper.WaitHelper;
	import bz.yfw.example.s3blazeds.part1.service.PingService;
	import bz.yfw.example.s3blazeds.part1.validator.TopValidator;
	import bz.yfw.example.s3blazeds.part1.view.TopView;
	
	import org.seasar.akabana.yui.framework.ns.handler;
	import org.seasar.akabana.yui.service.event.FaultStatus;
	import org.seasar.akabana.yui.service.ns.rpc_fault;
	import org.seasar.akabana.yui.service.ns.rpc_result;

	public class WaitBehavior
	{
		public var helper:WaitHelper;
		public var pingService:PingService;
		
		handler function on_viewInitialized():void{
			pingService.ping().setResponder(this);
		}
		
		rpc_result function pingService_ping(result:String):void {
			pushTop();
		}
		
		rpc_fault function pingService_ping(fault:FaultStatus):void {
			pushTop();
		}
		
		private function pushTop():void {
			helper.move(TopView);
		}
	}
}